package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.util.ApplicablePlatformEnum;
import com.frogs.system.util.ExpandCodeEnum;
import com.frogs.system.util.TaskTypeEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 完成任务请求参数类
 *
 * @author lijian
 * @version 2014年10月21日 - 上午11:01:31
 */
public class TaskCompleteRequest extends Request {

	private Integer taskCompleteInfoId;
	
	private Integer userId;
	
	private Integer taskType;
	
	private String expandCode;
	
	private Integer applicablePlatformId;
	
	public TaskCompleteRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.taskCompleteInfoId = requestInfo.getIntParameter(ApiUrlParamEnum.taskCompleteInfoId.getParamName(), 0);
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.taskType = requestInfo.getIntParameter(ApiUrlParamEnum.taskType.getParamName(), TaskTypeEnum.FLOWTASK.getId());
		this.expandCode = requestInfo.getParameter(ApiUrlParamEnum.expandCode.getParamName(), ExpandCodeEnum.MALL.getId());
		this.applicablePlatformId = requestInfo.getIntParameter(ApiUrlParamEnum.applicablePlatformId.getParamName(), ApplicablePlatformEnum.WEB.getId());
		
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
	}

	public Integer getUserId() {
		return userId;
	}

	public void setUserId(Integer userId) {
		this.userId = userId;
	}

	public Integer getTaskType() {
		return taskType;
	}

	public void setTaskType(Integer taskType) {
		this.taskType = taskType;
	}

	public Integer getTaskCompleteInfoId() {
		return taskCompleteInfoId;
	}

	public void setTaskCompleteInfoId(Integer taskCompleteInfoId) {
		this.taskCompleteInfoId = taskCompleteInfoId;
	}

	public String getExpandCode() {
		return expandCode;
	}

	public void setExpandCode(String expandCode) {
		this.expandCode = expandCode;
	}

	public Integer getApplicablePlatformId() {
		return applicablePlatformId;
	}

	public void setApplicablePlatformId(Integer applicablePlatformId) {
		this.applicablePlatformId = applicablePlatformId;
	}

}
